package com.yunxi.service.dubboService.impl;

import com.github.pagehelper.PageInfo;
import com.yunxi.model.stock.PartnerStockOut;
import com.yunxi.service.localService.PartnerStockOutService;
import com.yunxi.stock.pojo.PartnerStockOutVO;
import com.yunxi.stock.service.PartnerStockOutDubboService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

/**
 * <p>
 * 渠道商退车出库表 服务实现类
 * </p>
 *
 * @author chenmeng
 * @since 2019-07-24
 */
public class PartnerStockOutDubboServiceImpl implements PartnerStockOutDubboService {

    @Autowired
    @Qualifier(value = "partnerStockOutServiceImpl")
    PartnerStockOutService partnerStockOutService;


    @Override
    public PartnerStockOutVO getById(String id) throws InvocationTargetException, IllegalAccessException {
    PartnerStockOut partnerStockOut = partnerStockOutService.getById(id);
    PartnerStockOutVO partnerStockOutVO = new PartnerStockOutVO();
        BeanUtils.copyProperties(partnerStockOut,partnerStockOutVO);
        return partnerStockOutVO;
    }

    @Override
    public void saveOrUpdate(PartnerStockOutVO partnerStockOutVO) throws InvocationTargetException, IllegalAccessException {
    PartnerStockOut partnerStockOut = new PartnerStockOut();
        BeanUtils.copyProperties(partnerStockOutVO,partnerStockOut);
    partnerStockOutService.saveOrUpdate(partnerStockOut);
    }

    @Override
    public void removeById(String id) {
    partnerStockOutService.removeById(id);
    }

    @Override
    public PageInfo<PartnerStockOutVO> findPageByVO(PartnerStockOutVO partnerStockOutVO, Integer pageNum, Integer pageSize) throws InvocationTargetException, IllegalAccessException {
      PageInfo<PartnerStockOutVO> pageInfo = partnerStockOutService.pageByVo(partnerStockOutVO,pageNum,pageSize);
      return pageInfo;
   }

    @Override
    public void removeByListVo(List<PartnerStockOutVO> partnerStockOutVOList) throws IllegalAccessException, InvocationTargetException, InstantiationException {
        partnerStockOutService.removeByListVo(partnerStockOutVOList);
    }

    @Override
    public List listByVo(PartnerStockOutVO partnerStockOutVO) {
      return partnerStockOutService.listByVo(partnerStockOutVO);
    }
}
